Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go1.11.1 updates tracking #1

Merged
merged 13 commits into from
Oct 5, 2018
Merged

Conversation

changkun
Copy link
Owner

This PR is open for tracking changes in go1.11, and it will not be closed until the next release.

The changes help changkun/go-under-the-hood up-to-date.

dmitshur and others added 13 commits September 18, 2018 22:11
…environment variable

In Go 1.11, cmd/go gained support for the GOFLAGS environment variable.
It was added and described in detail in CL 126656.
Mention it in the Go 1.11 release notes, link to the cmd/go documentation,
and add more details there.

Fixes golang#27387.

Change-Id: Ifc35bfe3e0886a145478d36dde8e80aedd8ec68e
Reviewed-on: https://go-review.googlesource.com/135035
Reviewed-by: Bryan C. Mills <[email protected]>
Reviewed-by: Rob Pike <[email protected]>
(cherry picked from commit 58c6afe)
Reviewed-on: https://go-review.googlesource.com/135496
Reviewed-by: Dmitri Shuralyov <[email protected]>
…is not read

The Fetch API returns a null body if there is no response body,
on browsers that support streaming the response body. This
change ensures we check for both undefined and null bodies
before attempting to read the body.

Fixes golang#27424

Change-Id: I0da86b61284fe394418b4b431495e715a037f335
Reviewed-on: https://go-review.googlesource.com/131236
Reviewed-by: Richard Musiol <[email protected]>
Run-TryBot: Richard Musiol <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
(cherry picked from commit ce53683)
Reviewed-on: https://go-review.googlesource.com/136915
They aren't really races, or at least they don't have any
observable effect. The spec is silent on whether these are actually
races or not.

Fix this problem by not using the address of len (or of cap)
as the location where channel operations are recorded to occur.
Use a random other field of hchan for that.

I'm not 100% sure we should in fact fix this. Opinions welcome.

Fixes golang#27778

Change-Id: Ib4efd4b62e0d1ef32fa51e373035ef207a655084
Reviewed-on: https://go-review.googlesource.com/135698
Reviewed-by: Dmitry Vyukov <[email protected]>
(cherry picked from commit 83dfc3b)
Reviewed-on: https://go-review.googlesource.com/138179
Run-TryBot: Keith Randall <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
…answers of requested type

DNS responses which do not contain answers of the requested type return
errNoSuchHost, the same error as rcode name error. Prior to
golang.org/cl/37879, both cases resulted in no additional name servers
being consulted for the question. That CL changed the behavior for both
cases. Issue golang#25336 was filed about the rcode name error case and
golang.org/cl/113815 fixed it. This CL fixes the no answers of requested
type case as well.

Updates golang#27525
Fixes golang#27537

Change-Id: I52fadedcd195f16adf62646b76bea2ab3b15d117
Reviewed-on: https://go-review.googlesource.com/133675
Run-TryBot: Ian Gudger <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Brad Fitzpatrick <[email protected]>
(cherry picked from commit 94f48dd)
Reviewed-on: https://go-review.googlesource.com/138175
Run-TryBot: Brad Fitzpatrick <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
Strip a trailing "le" from the GOARCH value when calculating the GOxxx
environment variable that affects it.

Updates golang#27260
Fixes golang#27420

Change-Id: I081f30d5dc19281901551823f4f56be028b5f71a
Reviewed-on: https://go-review.googlesource.com/131379
Reviewed-by: Brad Fitzpatrick <[email protected]>
(cherry picked from commit 61318d7)
Reviewed-on: https://go-review.googlesource.com/138176
Run-TryBot: Brad Fitzpatrick <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
Missing from https://golang.org/project

Change-Id: I6cb769ae861a81f0264bae624b5fe8d70aa92497
Reviewed-on: https://go-review.googlesource.com/138356
Reviewed-by: Chris Broadfoot <[email protected]>
… for method funcs

Fix the code to use write barriers on heap memory, and no
write barriers on stack memory.

These errors were discovered as part of fixing golang#27695. They may
have something to do with that issue, but hard to be sure.
The core cause is different, so this fix is a separate CL.

Update golang#27867

Change-Id: Ib005f6b3308de340be83c3d07d049d5e316b1e3c
Reviewed-on: https://go-review.googlesource.com/137438
Reviewed-by: Austin Clements <[email protected]>
(cherry picked from commit e35a412)
Reviewed-on: https://go-review.googlesource.com/138581
Run-TryBot: Ian Lance Taylor <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
…lues

During a call to a reflect-generated function or method (via
makeFuncStub or methodValueCall), when should we scan the return
values?

When we're starting a reflect call, the space on the stack for the
return values is not initialized yet, as it contains whatever junk was
on the stack of the caller at the time. The return space must not be
scanned during a GC.

When we're finishing a reflect call, the return values are
initialized, and must be scanned during a GC to make sure that any
pointers in the return values are found and their referents retained.

When the GC stack walk comes across a reflect call in progress on the
stack, it needs to know whether to scan the results or not. It doesn't
know the progress of the reflect call, so it can't decide by
itself. The reflect package needs to tell it.

This CL adds another slot in the frame of makeFuncStub and
methodValueCall so we can put a boolean in there which tells the
runtime whether to scan the results or not.

This CL also adds the args length to reflectMethodValue so the
runtime can restrict its scanning to only the args section (not the
results) if the reflect package says the results aren't ready yet.

Do a delicate dance in the reflect package to set the "results are
valid" bit. We need to make sure we set the bit only after we've
copied the results back to the stack. But we must set the bit before
we drop reflect's copy of the results. Otherwise, we might have a
state where (temporarily) no one has a live copy of the results.
That's the state we were observing in issue golang#27695 before this CL.

The bitmap used by the runtime currently contains only the args.
(Actually, it contains all the bits, but the size is set so we use
only the args portion.) This is safe for early in a reflect call, but
unsafe late in a reflect call. The test issue27695.go demonstrates
this unsafety. We change the bitmap to always include both args
and results, and decide at runtime which portion to use.

issue27695.go only has a test for method calls. Function calls were ok
because there wasn't a safepoint between when reflect dropped its copy
of the return values and when the caller is resumed. This may change
when we introduce safepoints everywhere.

This truncate-to-only-the-args was part of CL 9888 (in 2015). That
part of the CL fixed the problem demonstrated in issue27695b.go but
introduced the problem demonstrated in issue27695.go.

TODO, in another CL: simplify FuncLayout and its test. stack return
value is now identical to frametype.ptrdata + frametype.gcdata.

Update golang#27867

Change-Id: I2d49b34e34a82c6328b34f02610587a291b25c5f
Reviewed-on: https://go-review.googlesource.com/137440
Run-TryBot: Keith Randall <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Austin Clements <[email protected]>
Reviewed-on: https://go-review.googlesource.com/138582
Run-TryBot: Ian Lance Taylor <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
R0 isn't the zero register any more. Oops.

Update golang#27867

Change-Id: I46a975ed37d5e570afe2e228d3edf74949e08ad7
Reviewed-on: https://go-review.googlesource.com/138580
Reviewed-by: Michael Munday <[email protected]>
Reviewed-on: https://go-review.googlesource.com/138583
Run-TryBot: Keith Randall <[email protected]>
Run-TryBot: Ian Lance Taylor <[email protected]>
Run-TryBot: Michael Munday <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
…le TXT record

When go resolver was changed to use dnsmessage.Parser, LookupTXT
returned two strings in one record as two different records. This change
reverts back to concatenating multiple strings in a single
TXT record.

Updates golang#27763
Fixes golang#27886

Change-Id: Ice226fcb2be4be58853de34ed35b4627acb429ea
Reviewed-on: https://go-review.googlesource.com/136955
Reviewed-by: Ian Gudger <[email protected]>
Reviewed-by: Brad Fitzpatrick <[email protected]>
Run-TryBot: Ian Gudger <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
(cherry picked from commit 7b3b160323b56b357832549fbab7a60d27688ec1)
Reviewed-on: https://go-review.googlesource.com/138177
Run-TryBot: Brad Fitzpatrick <[email protected]>
Reviewed-by: Katie Hockman <[email protected]>
… field and struct values

Updates golang#26444
Updates golang#27275
Fixes golang#27318

Change-Id: I9e8cbff79f7643ca8964c572c1a98172b6831730
GitHub-Last-Rev: 7eea215
GitHub-Pull-Request: golang#26719
Reviewed-on: https://go-review.googlesource.com/126897
Reviewed-by: Daniel Martí <[email protected]>
Run-TryBot: Daniel Martí <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-on: https://go-review.googlesource.com/138178
Run-TryBot: Brad Fitzpatrick <[email protected]>
Updates golang#27953

Change-Id: I2f1a55e15dc5737a5a06bd894c46b2c4705f338c
Reviewed-on: https://go-review.googlesource.com/138858
Reviewed-by: Filippo Valsorda <[email protected]>
(cherry picked from commit f99fc3a)
Reviewed-on: https://go-review.googlesource.com/138859
Reviewed-by: Dmitri Shuralyov <[email protected]>
Change-Id: I3cf3e57b11ad02b497276bae1864fc5ade8144b9
Reviewed-on: https://go-review.googlesource.com/138860
Run-TryBot: Katie Hockman <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
@changkun changkun changed the title go1.11 updates tracking go1.11.1 updates tracking Oct 4, 2018
@changkun changkun merged commit 42843d1 into go-under-the-hood Oct 5, 2018
changkun pushed a commit that referenced this pull request Apr 12, 2019
Most chars in URLs are lowercase, so check that first.

Performance change:

String-4               7.62µs ± 1%    7.27µs ± 3%  -4.61%  (p=0.008 n=5+5)
QueryEscape/#00-4      92.6ns ± 3%    90.3ns ± 1%  -2.48%  (p=0.016 n=5+5)
QueryEscape/#1-4       515ns ± 4%     510ns ± 2%    ~     (p=0.683 n=5+5)
QueryEscape/#2-4       375ns ± 1%     343ns ± 1%  -8.52%  (p=0.008 n=5+5)
QueryEscape/#3-4       758ns ± 1%     699ns ± 1%  -7.83%  (p=0.008 n=5+5)
QueryEscape/#4-4      6.06µs ± 1%    5.74µs ± 1%  -5.38%  (p=0.008 n=5+5)
PathEscape/#00-4        140ns ± 1%     135ns ± 2%  -3.85%  (p=0.008 n=5+5)
PathEscape/#1-4        511ns ± 3%     507ns ± 3%    ~     (p=0.587 n=5+5)
PathEscape/#2-4        372ns ± 1%     342ns ± 2%  -8.22%  (p=0.008 n=5+5)
PathEscape/#3-4        747ns ± 1%     685ns ± 1%  -8.30%  (p=0.008 n=5+5)
PathEscape/#4-4       5.94µs ± 1%    5.64µs ± 3%  -4.98%  (p=0.008 n=5+5)
QueryUnescape/#00-4     111ns ± 4%     110ns ± 2%    ~     (p=0.952 n=5+5)
QueryUnescape/#1-4     390ns ± 0%     391ns ± 2%    ~     (p=0.714 n=5+5)
QueryUnescape/#2-4     297ns ± 5%     295ns ± 3%    ~     (p=0.524 n=5+5)
QueryUnescape/#3-4     543ns ± 3%     556ns ± 2%  +2.39%  (p=0.032 n=5+5)
QueryUnescape/#4-4    3.23µs ± 3%    3.22µs ± 2%    ~     (p=1.000 n=5+5)
PathUnescape/#00-4      111ns ± 1%     110ns ± 3%    ~     (p=0.881 n=5+5)
PathUnescape/#1-4      389ns ± 2%     386ns ± 2%    ~     (p=0.444 n=5+5)
PathUnescape/#2-4      297ns ± 1%     295ns ± 3%    ~     (p=0.738 n=5+5)
PathUnescape/#3-4      557ns ± 3%     553ns ± 2%    ~     (p=0.810 n=5+5)
PathUnescape/#4-4     2.94µs ± 2%    2.97µs ± 2%    ~     (p=0.222 n=5+5)

Change-Id: I7e6d64cd5f8f5218cb40f52f0015168a8674aabb
Reviewed-on: https://go-review.googlesource.com/c/go/+/168883
Reviewed-by: Brad Fitzpatrick <[email protected]>
changkun pushed a commit that referenced this pull request Jun 7, 2019
Build result string via string.Builder to avoid allocation.
As side effect some performance boots.

name                 old time/op    new time/op    delta
QueryUnescape/#00-4     114ns ± 0%      98ns ± 1%  -13.89%  (p=0.000 n=4+5)
QueryUnescape/#1-4     401ns ± 2%     383ns ± 1%   -4.54%  (p=0.008 n=5+5)
QueryUnescape/#2-4     300ns ± 2%     274ns ± 2%   -8.66%  (p=0.008 n=5+5)
QueryUnescape/#3-4     564ns ± 2%     542ns ± 2%   -4.04%  (p=0.008 n=5+5)
QueryUnescape/#4-4    3.27µs ± 2%    3.34µs ± 8%     ~     (p=0.690 n=5+5)
PathUnescape/#00-4      112ns ± 2%      99ns ± 3%  -11.25%  (p=0.008 n=5+5)
PathUnescape/#1-4      392ns ± 2%     374ns ± 6%     ~     (p=0.063 n=5+5)
PathUnescape/#2-4      296ns ± 2%     274ns ± 2%   -7.43%  (p=0.008 n=5+5)
PathUnescape/#3-4      556ns ± 2%     537ns ± 1%   -3.45%  (p=0.008 n=5+5)
PathUnescape/#4-4     2.99µs ± 1%    3.00µs ± 1%     ~     (p=0.690 n=5+5)

name                 old allocs/op  new allocs/op  delta
QueryUnescape/#00-4      2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.008 n=5+5)
QueryUnescape/#1-4      2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.008 n=5+5)
QueryUnescape/#2-4      2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.008 n=5+5)
QueryUnescape/#3-4      2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.008 n=5+5)
QueryUnescape/#4-4      2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.008 n=5+5)
PathUnescape/#00-4       2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.008 n=5+5)
PathUnescape/#1-4       2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.008 n=5+5)
PathUnescape/#2-4       2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.008 n=5+5)
PathUnescape/#3-4       2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.008 n=5+5)
PathUnescape/#4-4       2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.008 n=5+5)

Change-Id: I7cba5eb53bebef7b1fdd44598eed47241ce83167
Reviewed-on: https://go-review.googlesource.com/c/go/+/166463
Reviewed-by: Brad Fitzpatrick <[email protected]>
Run-TryBot: Brad Fitzpatrick <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
changkun pushed a commit that referenced this pull request Oct 30, 2019
A common idiom for turning an unsafe.Pointer into a slice is to write:

    s := (*[Big]T)(ptr)[:n:m]

This technically violates Go's unsafe pointer rules (rule #1 says T2
can't be bigger than T1), but it's fairly common and not too difficult
to recognize, so might as well allow it for now so we can make
progress on golang#34972.

This should be revisited if golang#19367 is accepted.

Updates golang#22218.
Updates golang#34972.

Change-Id: Id824e2461904e770910b6e728b4234041d2cc8bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/201839
Run-TryBot: Matthew Dempsky <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Brad Fitzpatrick <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants